const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('act_de_model', {
    id: {
      type: DataTypes.STRING(255),
      allowNull: false,
      primaryKey: true
    },
    name: {
      type: DataTypes.STRING(400),
      allowNull: false
    },
    modelKey: {
      type: DataTypes.STRING(400),
      allowNull: false,
      field: 'model_key'
    },
    description: {
      type: DataTypes.STRING(4000),
      allowNull: true
    },
    modelComment: {
      type: DataTypes.STRING(4000),
      allowNull: true,
      field: 'model_comment'
    },
    created: {
      type: DataTypes.DATE(6),
      allowNull: true
    },
    createdBy: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'created_by'
    },
    lastUpdated: {
      type: DataTypes.DATE(6),
      allowNull: true,
      field: 'last_updated'
    },
    lastUpdatedBy: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'last_updated_by'
    },
    version: {
      type: DataTypes.INTEGER,
      allowNull: true
    },
    modelEditorJson: {
      type: DataTypes.TEXT,
      allowNull: true,
      field: 'model_editor_json'
    },
    thumbnail: {
      type: DataTypes.BLOB,
      allowNull: true
    },
    modelType: {
      type: DataTypes.INTEGER,
      allowNull: true,
      field: 'model_type'
    },
    tenantId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'tenant_id'
    }
  }, {
    sequelize,
    tableName: 'act_de_model',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
      {
        name: "idx_proc_mod_created",
        using: "BTREE",
        fields: [
          { name: "created_by" },
        ]
      },
    ]
  });
};
